package com.ztjava.portal.model;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.ehcache.CacheKit;
import com.ztjava.core.HModel;
import com.ztjava.core.InitConfig;

public class PortalParam extends Model<PortalParam> implements HModel{
	public static PortalParam dao = new PortalParam();
	public static String tablename = "h_portal_param";
	
	private String[][] columns = new String[][]{
			new String[]{"name","varchar","50"},
			new String[]{"code","varchar","50"},
			new String[]{"value","varchar","100"},
			new String[]{"remark","varchar","200"},
			new String[]{"update_user","int","11"},
			new String[]{"create_user","int","11"}
	};
	
	public static void loadCache(){
		List<PortalParam> list = PortalParam.dao.find("select * from "+PortalParam.tablename);
		
		for(PortalParam item:list){
			String remark = "";
			if(item.get("remark")!=null){
				remark = item.getStr("remark");
			}
			InitConfig.setParam(item.getStr("name"), item.getStr("code"), item.getStr("value"), remark);
			
		}
	}


	@Override
	public String[][] getColumns() {
		// TODO Auto-generated method stub
		return columns;
	}

	@Override
	public String getTablename() {
		// TODO Auto-generated method stub
		return tablename;
	}
}
